package com.quectel.dms.service.aiotap;

import cn.hutool.system.SystemUtil;
import com.quectel.util.common.OSUtils;
import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.Platform;

public class ThirdLibrary {




    public static final String AIOTAP_LIB_PATH = System.getProperty(SystemUtil.USER_HOME) + "/" + ".aiotap";


    public interface SSL extends Library {
        //linux下如用ssl将会优先调用系统的libssl资源,windows平台不需要
        SSL INSTANTCE = (Platform.isLinux() ? (SSL) Native.load(AIOTAP_LIB_PATH+"/libssl_1_0_2.so", SSL.class) : null);
    }

    public interface CRYPTO extends Library {
        //linux下如用crypto 将会优先调用系统的libcrypto资源,windows平台不需要
        CRYPTO INSTANTCE = (Platform.isLinux() ? (CRYPTO) Native.load(AIOTAP_LIB_PATH+"/libcrypto.so.1.0.0", CRYPTO.class) : null);
    }

    public interface MXML extends Library {
        MXML INSTANTCE = (Platform.isLinux() ? (MXML) Native.load(AIOTAP_LIB_PATH+"/libmxml.so", MXML.class) : null);
    }

    public interface SPDLOG extends Library {
        SPDLOG INSTANTCE = (Platform.isLinux() ? (SPDLOG) Native.load(AIOTAP_LIB_PATH+"/libspdlog.so", SPDLOG.class) : null);
    }

    public interface TARO extends Library {
        TARO INSTANTCE = (Platform.isLinux() ? (TARO) Native.load(AIOTAP_LIB_PATH+"/libtaro.so", TARO.class) : null);
    }

    public interface CARES extends Library {
        CARES INSTANTCE = (OSUtils.isDebianRelease() ? (CARES) Native.load(AIOTAP_LIB_PATH+"/libcares.so", CARES.class) : null);
    }

    public interface JSONSCHEMA extends Library {
        JSONSCHEMA INSTANTCE = (OSUtils.isDebianRelease() ? (JSONSCHEMA) Native.load(AIOTAP_LIB_PATH+"/libjson_schema_validator.so", JSONSCHEMA.class) : null);
    }

    public interface LLHTTP extends Library {
        LLHTTP INSTANTCE = (OSUtils.isDebianRelease() ? (LLHTTP) Native.load(AIOTAP_LIB_PATH+"/libllhttp.so", LLHTTP.class) : null);
    }
}
